package com.senthink.gl.business.auth;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 前端传递的权限树形结构(区域权限和目录权限)
 *
 * @author zooqi@senthink.com
 * @date 2018/03/02
 */
@ApiModel(value = "前端传递的权限树形结构(区域权限和目录权限)")
@Getter
@Setter
public class AuthorityTreeDto {

    /**
     * ID
     */
    @ApiModelProperty(value = "ID")
    private String id;

    /**
     * 标签
     */
    @ApiModelProperty(value = "标签")
    private String label;

    /**
     * 子节点
     */
    @ApiModelProperty(value = "子节点")
    private List<AuthorityTreeDto> children;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        AuthorityTreeDto that = (AuthorityTreeDto) o;

        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + id.hashCode();
        return result;
    }
}
